home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 4.2 KB | 99 lines | [TEXT/MPS ] |
- //=======================================================================================
- //
- // SoundHelper.h - public header for the Asynchronous Sound Helper
- //
- // Written by Bryan K. Ressler (Beaker), 2/4/92
- //
- // Version 1.00, 2/4/92 Original version
- // 1.01, 2/20/92 Added SHGetState to fix handle semaphore problem
- // 1.02, 3/21/92 Make handle/error checks more explicit, modify
- // SHPlayStopByRec (to handle channels with no synthesizer)
- // 1.03, 4/4/92 Modifications per KO, RC, JR. Public routines now pascal.
- // 1.04, 4/20/92 Reverted to SHPlayPause/SHPlayContinue structure.
- //
- //=======================================================================================
-
- //=======================================================================================
- // Includes
- //=======================================================================================
- #include "Std.h"
-
- //=======================================================================================
- // Enumerated types
- //=======================================================================================
- typedef enum {
- shpError = -1,
- shpFinished = 0,
- shpPaused = 1,
- shpPlaying = 2
- } SHPlayStat;
-
- typedef enum {
- shrError = -1,
- shrFinished = 0,
- shrPaused = 1,
- shrRecording = 2
- } SHRecordStat;
-
- //=======================================================================================
- // Sound Helper error codes
- //=======================================================================================
- #define kSHErrOutaChannels 1 // No more output records are available
- #define kSHErrBadRefNum 2 // Invalid reference number
- #define kSHErrNonAsychDevice 3 // Input device can't handle asynchronous input
- #define kSHErrNoRecording 4 // There's no recording to return
- #define kSHErrNotRecording 5 // Not allowed because we're not recording
- #define kSHErrAlreadyPaused 6 // Already paused
- #define kSHErrAlreadyContinued 7 // Already continued
-
- //=======================================================================================
- // Structures
- //=======================================================================================
- typedef struct {
- SHRecordStat recordStatus; // Current record status
- unsigned long totalRecordTime; // Total (maximum) record time in ms
- unsigned long currentRecordTime; // Current recorded time in ms
- short meterLevel; // 0..255, the current input level
- } SHRecordStatusRec;
-
- //=======================================================================================
- // Initialization, idle, and termination
- //=======================================================================================
- pascal OSErr SHInitSoundHelper(Boolean *attnFlag, short numChannels);
- pascal void SHIdle(void);
- pascal void SHKillSoundHelper(void);
-
- //=======================================================================================
- // Easy sound output
- //=======================================================================================
- pascal OSErr SHPlayByID(short resID, long *refNum);
- pascal OSErr SHPlayByHandle(Handle sound, long *refNum);
-
- pascal OSErr SHPlayStop(long refNum);
- pascal OSErr SHPlayStopAll(void);
-
- //=======================================================================================
- // Advanced sound output
- //=======================================================================================
- pascal OSErr SHPlayPause(long refNum);
- pascal OSErr SHPlayContinue(long refNum);
-
- pascal SHPlayStat SHPlayStatus(long refNum);
- pascal OSErr SHGetChannel(long refNum, SndChannelPtr *channel);
-
- //=======================================================================================
- // Easy sound input
- //=======================================================================================
- pascal OSErr SHRecordStart(short maxK, OSType quality, Boolean *doneFlag);
- pascal OSErr SHGetRecordedSound(Handle *theSound);
-
- pascal OSErr SHRecordStop(void);
-
- //=======================================================================================
- // Advanced sound input
- //=======================================================================================
- pascal OSErr SHRecordPause(void);
- pascal OSErr SHRecordContinue(void);
-
- pascal OSErr SHRecordStatus(SHRecordStatusRec *recordStatus);
-